package com.ljx.rabbit.handler;

import com.ljx.rabbit.result.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler
    public R error(RuntimeException e){
        log.error("出现了异常：{}",e);
        return R.error(e.getMessage());
    }
}
